package service

import "errors"

type AuthRequest struct {
	AppKey    string `json:"app_key,omitempty" binding:"required"`    //设置为必填项
	AppSecret string `json:"app_secret,omitempty" binding:"required"` //设置为必填项
}

func (svc *Service) CheckAuth(param *AuthRequest) error {
	auth, err := svc.dao.GetAuth(param.AppKey, param.AppSecret)
	if err != nil {
		return err
	}
	if auth.ID > 0 {
		return nil
	}
	return errors.New("auth info does not exist")
}
